
  class backToTop{
    constructor(){
        this.span = document.querySelector('#sidebar>.head>a>.span')
        this.dataNum = JSON.parse(localStorage.getItem('cart'))
        this.Scroll()
        this.number()
    }
    Scroll(){
        $(window).scroll(()=>{
            var h = $(window).scrollTop()
            if(h>=36){
                $('#nav').addClass('active')
            }else{
                $('#nav').removeClass('active')
            }
        })
       $('.top').on('click',function () { 
           $(window).scrollTop(0)
        })
    }
    number(){
        var arr = 0
        this.dataNum.forEach(item=> {
            arr += item.cart_Num
        });
        this.span.innerHTML = arr
    
    }
  }
  new backToTop()
  
  
  
  
  
 

   
    
   